package com.key.web_admin.controller;

import com.key.common.base.RespResult;
import com.key.modules.dto.*;
import com.key.modules.service.ComplainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/complain")
public class ComplainController {

    @Autowired
    private ComplainService complainService;

    @PostMapping("/addComplain")
    public RespResult addComplain(@RequestBody ComplainDTO complainDTO){

        return complainService.addComplain(complainDTO);
    }

    @GetMapping("/findAllComplain")
    public RespResult findAllComplain(@RequestBody CConditionDTO cConditionDTO){

        return complainService.findAllComplain(cConditionDTO);
    }

    @GetMapping("/findComplainById")
    public RespResult findComplainById(@RequestParam("id") Integer id){

        return complainService.findComplainById(id);
    }

    @PostMapping("/updateComplain")
    public RespResult updateComplain(@RequestBody ComplainDTO complainDTO){

        return complainService.updateComplain(complainDTO);
    }

    @PostMapping("/deleteComplain")
    public RespResult deleteComplain(@RequestBody List<Integer> ids){

        return complainService.deleteComplain(ids);
    }

    @PostMapping("/updateHState")
    public RespResult updateHState(@RequestBody HComplainDTO hComplainDTO){

        return complainService.updateHState(hComplainDTO);
    }

    @PostMapping("/updateFState")
    public RespResult updateFState(@RequestBody FComplainDTO fComplainDTO){

        return complainService.updateFState(fComplainDTO);
    }
}
